<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>购物车</h2>
	</div>
	<div class="cf">
		<div class="fl">
      <p style="float:left;margin-bottom:10px;">
          <a href="{:U('Cart/showcart',array('sort'=>'asc'))}" class="btn">ID正向排序</a>
          <a href="{:U('Cart/showcart',array('sort'=>'desc'))}" class="btn">ID逆向排序</a>
      </p>
    </div>

    <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
				<input type="text" name="username" class="search-input" value="{:I('username')}" placeholder="请输入会员账号或者商品名称">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('showcart')}"><i class="btn-search"></i></a>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
      		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
      		<th class="">ID</th>
      		<th class="">会员账号</th>
      		<th class="">商品名称</th>
          <th class="">尺寸</th>
          <th class="">图片</th>
      		<th class="">数量</th>
      		<th class="">加入时间</th>
      		<th class="">状态</th>
    		</tr>
    </thead>
    <tbody>
		<notempty name="data">
		<volist name="data" id="list">
    		<tr>
          <td><input class="ids" type="checkbox" name="id[]" value="{$list.id}" /></td>
    			<td>{$list.id} </td>
    			<td>{$list.username}</td>
          <td>{$list.goods_name}</td>
    			<td>{$list.size}</td>
          <td><img src="{$list.image}" alt="" width="20"></td>
    			<td>{$list.num}</td>
    			<td>{$list.ctime}</td>
    			<td>{$list.status}</td>
    		</tr>
		</volist>
		<else/>
		    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('showcart')}');
	</script>
</block>
